package com.zhen.strategy.menu;

/**
 * 定义策略对象
 */
public enum BusiMenu {
    BUSI_ORDER("order", "orderStrategy"),
    BUSI_PAY("pay", "payStrategy");
    private String busiType;

    BusiMenu(String busiType, String strategy) {
        this.busiType = busiType;
        this.strategy = strategy;
    }

    private String strategy;

    public String getBusiType() {
        return busiType;
    }

    public void setBusiType(String busiType) {
        this.busiType = busiType;
    }

    public String getStrategy() {
        return strategy;
    }

    public void setStrategy(String strategy) {
        this.strategy = strategy;
    }

    // 根据busiType获取enum对象
    public static BusiMenu getEnumByBusiType(String busiType) {
        BusiMenu[] values = BusiMenu.values();
        for (BusiMenu temp : values) {
            if (temp.getBusiType().equals(busiType)) {
                return temp;
            }
        }
        return null;
    }
}
